<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>查看申请信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/>
    <meta name="apple-mobile-web-app-title" content="查看申请信息"/>
    <link rel="stylesheet" href="Css/amazeui.min.css"/>
    <script src="Scripts/api.js"></script>
    <link rel="stylesheet" href="Css/app.css"/>
    <link rel="stylesheet" href="Css/font_783249_3hfdb7m5w0j.css">
    <script src="Scripts/jquery.min.js"></script>
    <script src="Scripts/font_783249_e5yrsf08rap.js"></script>
    <script>
        BASE_URL = 'https://demo.yiovo.com/';
        STORE_URL = 'index.php?s=/store';
    </script>
    <script>

    </script>
</head>

<body data-type="">
<div class="am-g tpl-g">


    <!-- 内容区域 start -->
        <link href="assets/store/css/goods.css?v=1.1.15" rel="stylesheet">
        <link href="assets/common/plugins/umeditor/themes/default/css/umeditor.css" rel="stylesheet">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <form class="am-form tpl-form-line-form" id="my-form" method="post" novalidate="novalidate">
                            <div class="widget-body">
                                <fieldset>
                                    <div class="widget-head am-cf">
                                        <div class="widget-title am-fl">查看申请信息</div>

                                    </div>
                                    <from id = "my-from" >
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">申请ID </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <input name="title" class="tpl-form-input" id = "examineid" required="" type="text" value="" disabled="true">
                                            </div>
                                        </div>
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">用户ID </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <input name="title" class="tpl-form-input" id = "userid" required="" type="text" value="" disabled="true">
                                            </div>
                                        </div>
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">申请类型 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <input name="title" class="tpl-form-input" id = "examinetype" required="" type="text" value="" disabled="true">
                                            </div>
                                        </div>
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">审核图片 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <div class="am-form-file">
                                                    <div class="am-form-file">
                                                        <div class="uploader-list am-cf">
                                                        </div>
                                                    </div>
                                                </div>
                                                <img id="examineimage" src=""/>
                                            </div>
                                        </div>
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">审核状态 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <input name="title" class="tpl-form-input" id = "examinestate" required="" type="text" value="" disabled="true">
                                            </div>
                                        </div>
                                        <div class="am-form-group">
                                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">审核描述 </label>
                                            <div class="am-u-sm-9 am-u-end">
                                                <input name="content" class="v" type="text" id = "examinecontent" value="" disabled="true">
                                                <small></small>
                                            </div>
                                        </div>
                                    </from>
                                    <div class="am-form-group">
                                        <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg" id ="buttonList">

                                        </div>
                                    </div>
                                    <div class="am-form-group">

                                    </div>
                                </fieldset>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        <script>

            //获得网址中的参数
            var getParam = function(name){
                var search = document.location.search;
                var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
                var matcher = pattern.exec(search);
                var items = null;
                if(null != matcher){
                    try{
                        items = decodeURIComponent(decodeURIComponent(matcher[1]));
                    }catch(e){
                        try{
                            items = decodeURIComponent(matcher[1]);
                        }catch(e){
                            items = matcher[1];
                        }
                    }
                }
                return items;
            };
            //获得要修改小知识的ID
            var examineid = getParam('examineid');
            var eestate = 0;



            var getbyIdcallback = function (wxhelpdata) {
                    isUpdate = true;
                    var eid = JSON.stringify(wxhelpdata['id']).replace(/"/g,"");
                    var uid = JSON.stringify(wxhelpdata['userId']).replace(/"/g,"");
                    var etype = JSON.stringify(wxhelpdata['type']).replace(/"/g,"");
                    eestate = JSON.stringify(wxhelpdata['state']).replace(/"/g,"");
                    var econtent = JSON.stringify(wxhelpdata['description']).replace(/"/g,"");
                    $("#examineid").val(eid);
                    $("#userid").val(uid);

                    var etypeint = parseInt(etype);
                    var types = null;
                    if(etypeint==0)
                    {
                        types = "医生";
                    }else if(etypeint==1)
                    {
                        types = "护士";
                    }else if(etypeint==2)
                    {
                        types = "企业";

                    }else{
                        types = "手工艺者";
                    }
                    $("#examinetype").val(types);
                    if(eestate==0)
                    {
                        var htmlbutton = " <button class=\"j-agree am-btn am-btn-secondary\" type=\"button\" onClick=\"agreeExamine("+eid+")\"\n " +
                            "                                            >同意\n" +
                            "                                            </button>\n" +
                            "                                            <button class=\"j-disagree am-btn am-btn-secondary\" onClick=\"disagreeExainme("+eid+")\" \n" +
                            "                                            >拒绝\n" +
                            "                                            </button>\n" +
                            "                                            <button class=\"j-submit am-btn am-btn-secondary\" type=\"button\" onclick='reback()' \n" +
                            "                                            >返回\n" +
                            "                                            </button>";
                        $("#buttonList").append(htmlbutton);

                        $("#examinestate").val("未审核");
                    }

                    else if(eestate==1){
                        var htmlbutton = "<button class=\"j-disagree am-btn am-btn-secondary\" type=\"button\" onclick='disagreeExainme("+eid+")' \n" +
                            "                                            >取消认证\n" +
                            "                                            </button>\n" +
                            "                                            <button class=\"j-submit am-btn am-btn-secondary\" type=\"button\" onclick='reback()' \n" +
                            "                                            >返回\n" +
                            "                                            </button>";
                        $("#buttonList").append(htmlbutton);
                        $("#examinestate").val("审核成功");
                    }

                    else
                    {
                        var htmlbutton = "<button class=\"j-submit am-btn am-btn-secondary\" type=\"button\" onclick='reback()' \n" +
                            "                                            >返回\n" +
                            "                                            </button>";
                        $("#buttonList").append(htmlbutton);
                        var ree = JSON.stringify(wxhelpdata['reasion']).replace(/"/g,"");
                        var re = "<div class=\"am-form-group\">\n" +
                            "                                            <label class=\"am-u-sm-3 am-u-lg-2 am-form-label form-require\">审核失败原因 </label>\n" +
                            "                                            <div class=\"am-u-sm-9 am-u-end\">\n" +
                            "                                                <input name=\"content\" class=\"v\" type=\"text\" id = \"examinere\" value=\"\" disabled=\"true\">\n" +
                            "                                                <small></small>\n" +
                            "                                            </div>\n" +
                            "                                        </div>";
                        $("#my-from").append(re);
                        $("#examinestate").val("审核失败");
                        $("#examinere").val(ree);

                    }
                    $("#examinecontent").val(econtent);
                };
            var getExamineImagecallback = function (wxhelpdata) {
                    document.getElementById('examineimage').src = wxhelpdata;
                };
            if(examineid!=null)
            {
                getExaminById(examineid,getbyIdcallback);

                getExamineImageById(examineid,getExamineImagecallback);

            }

            //同意审核href=\"javascript:deleteItem("+hid+");\"

            var agreecallback = function (res) {
                    if(res.status==200)
                    {
                        alert("同意审核！");
                        window.location.href = "/admin/UserExamine.html";
                    }
                    else
                    {
                        alert(res.message+",status:"+res.status);
                    }
                };

            function agreeExamine(sid) {
                agreeExamineApi(sid,agreecallback);

            }

            //拒绝审核审核
            function disagreeExainme(sid) {
                window.location.href = "/admin/FailExamine.html?examineid="+sid;
            }
            //返回
            function reback() {
                window.location.href = "/admin/UserExamine.html";
            }



        </script>







    <!-- 内容区域 end -->

</div>

<script src="Scripts/layer.js"></script>
<script src="Scripts/jquery.form.min.js"></script>
<script src="Scripts/amazeui.min.js"></script>
<script src="Scripts/webuploader.html5only.js"></script>
<script src="Scripts/art-template.js"></script>
<script src="Scripts/app.js"></script>
<script src="Scripts/file.library.js"></script>



</body></html>